
<template>
  <view class="container">
    <Navbar showNavbar title="社团兴趣选课系统"/>
    <!-- 轮播图区域 -->
    <swiper class="banner-box" circular autoplay interval="3000" duration="500">
      <swiper-item v-for="(item, index) in bannerList" :key="index">
        <image class="banner-image" :src="item.image" mode="aspectFit"/>
      </swiper-item>
    </swiper>

    <!-- 热点资讯 -->
    <view class="news-box">
      <image style="width: 118rpx;height: 36rpx;flex-shrink: 0;margin-right: 12rpx" src="/static/home/hot_icon.png"></image>
    </view>

    <view>
      <view v-for="item in newList" :key="item.id" style="padding: 20rpx;background-color: #fff;border-radius: 14rpx;margin-bottom: 14rpx">
        <u-parse :html="item.content"></u-parse>
      </view>
    </view>
  </view>
</template>

<script>
import Navbar from "../../components/navbar.vue";
import ItemDetail from "../course/itemDetail.vue";
export default {
  name: "index",
  components: {
    Navbar,
  },
  data() {
    return {
      newList: [

      ],
      bannerList: [
      ],
    }
  },
  methods: {
  },
  // 分享
  onShareAppMessage() {
    return {
      title: '社团兴趣选课系统',
      path: '/pages/home/index'
    }
  },
  onLoad() {
    this.$api.getWxNewsList().then(res => {
      this.newList = res
    })
    this.$api.getWxBannerList().then(res => {
      this.bannerList = res
    })
  }
}
</script>

<style>
page {
  height: 100vh;
  overflow: hidden;
  padding-bottom: 120rpx;
}

.container {
  height: 100%;
  overflow: auto;
  padding: 0 30rpx;
  box-sizing: border-box;
  background: linear-gradient( 180deg, #E4F6FF 0%, #F7F8FA 100%);
}

.search-box {
  display: flex;
  align-items: center;
  height: 72rpx;
  background-color: #FFFFFF;
  border-radius: 36rpx;
  padding: 0 24rpx;
  margin: 24rpx 0;
}

.placeholder {
  margin-left: 16rpx;
  font-size: 14px;
  color: #999999;
}

.banner-box {
  flex-shrink: 0;
  width: 100%;
  height: 280rpx;
  border-radius: 16rpx;
  overflow: hidden;
  margin-bottom: 24rpx;
}

.banner-image {
  width: 100%;
  height: 100%;
}

.banner-content {
  position: absolute;
  top: 48rpx;
  left: 48rpx;
  color: #FFFFFF;
}

.banner-title {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 16rpx;
  display: block;
}

.banner-subtitle {
  font-size: 14px;
  margin-bottom: 24rpx;
  display: block;
}

.banner-button {
  display: inline-block;
  padding: 12rpx 32rpx;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 24rpx;
  font-size: 14px;
}

.news-box {
  display: flex;
  align-items: center;
  //background-color: #ffffff;

  padding:12rpx 0;
  border-radius: 12rpx;
  margin-bottom: 24rpx;
}

.news-swiper {
  flex: 1;
  height: 40rpx;
}

.news-text {
  font-size: 14px;
  color: #666666;
  line-height: 40rpx;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.grid-box {
  display: flex;
  flex-wrap: wrap;
  background-color: #F7F8FA;
  border-radius: 12rpx;
  padding: 24rpx 0;
}

.grid-item {
  width: 25%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24rpx;
}

.grid-icon {
  width: 92rpx;
  height: 92rpx;
}

.grid-text {
  font-size: 26rpx;
  color: #333333;
}

.tab-box {
  display: flex;
  margin-bottom: 24rpx;
}

.tab-item {
  font-size: 16px;
  color: #999999;
  margin-right: 48rpx;
}

.tab-item.active {
  color: #333333;
  font-weight: bold;
  position: relative;
}

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: -8rpx;
  left: 0;
  width: 100%;
  height: 4rpx;
  background-color: #1890FF;
  border-radius: 2rpx;
}
.house-item {
  background-color: #FFFFFF;
  border-radius: 12rpx;
  padding: 24rpx;
  margin-bottom: 24rpx;
  display: flex;
}

.house-image {
  width: 240rpx;
  height: 180rpx;
  border-radius: 12rpx;
  margin-right: 32rpx;
  flex-shrink: 0;
}

.house-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.house-title {
  font-size: 32rpx;
  color: #333333;
  font-weight: bold;
  margin-bottom: 12rpx;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.house-detail {
  display: flex;
  align-items: center;
  margin-bottom: 12rpx;
}

.location, .area, .type {
  font-size: 14px;
  color: #666666;
}
.line {
  height: 20rpx;
  width: 2rpx;
  background-color: #DCDCDC;
  margin: 0 24rpx;
}
.house-price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.price {
  font-size: 20px;
  color: #FF6B6B;
  font-weight: bold;
}

.unit {
  font-size: 14px;
  color: #FF6B6B;
  margin-left: 4rpx;
}

.unit-price {
  font-size: 14px;
  color: #999999;
  margin-left: 24rpx;
}

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100rpx;
  background-color: #FFFFFF;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid #EEEEEE;
}

.tab-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tab-bar-item text {
  font-size: 12px;
  color: #999999;
  margin-top: 4rpx;
}

.tab-bar-item.active text {
  color: #1890FF;
}
</style>
